package pers.lonestar.framework.utils.support.analysis.handler;

import pers.lonestar.framework.utils.support.contexts.XlsxReadContext;
import pers.lonestar.framework.utils.support.enums.CellDataTypeEnum;
import pers.lonestar.framework.utils.support.metadata.CellData;
import pers.lonestar.framework.utils.support.metadata.read.ReadSheet;
import pers.lonestar.framework.utils.support.metadata.read.ReadWorkbook;

public class CellValueHandler extends AbstractCellValueTagHandler {
    @Override
    protected void setStringValue(XlsxReadContext xlsxReadContext, ReadSheet readSheet) {
        ReadWorkbook readWorkbook = xlsxReadContext.getReadWorkbook();
        CellData<?> tempCellData = readSheet.getTempCellData();
        switch (tempCellData.getType()) {
            case STRING:
                tempCellData.setStringValue(readWorkbook.getReadCache().get(Integer.valueOf(tempCellData.getStringValue())));
                break;
            case DIRECT_STRING:
                tempCellData.setType(CellDataTypeEnum.STRING);
                break;
            default:
        }
    }
}
